import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'
const store = createStore({

    state(){
        return {
            userInfor: {},
            currentPath:'/'
        }
    },

    // 修改数据的方法
    mutations:{
        updateUserInfo(state, value){
            state.userInfor = value
        },
        updateCurrentPath(state, value){
            state.currentPath = value
        }
    },


    plugins:[
        createPersistedState({
            reducer:state =>{
                return {
                    userInfor: state.userInfor
                }
            }
        })
    ]

})

export default store